home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
tlx_sq21.zip
/
OPUSREG.SLT
< prev
next >
Wrap
Text File
|
1992-03-20
|
9KB
|
280 lines
//-----------------------------------------------------------
// OPUSREG.SL? Automatic registration to a new OPUS BBS system.
//
// Please look at the comments through the whole file, and modify to
// suit your needs before you use it. Then recompile with CS OPUSREG.
//-----------------------------------------------------------
// If you have suggestions for improving this script, please suggest
// improvements to me via old-fashioned snail-mail to:
// Author: Inge Vabekk
// Hamangskogen 108
// N-1300 SANDVIKA
// NORWAY
// tel. (472) 546 396
str thisBBStype[]="OPUS" // Works only for OPUS.
,command [10] // Current prompt (value)
,line [80] // Line for string storage.
// For the Global storage:
,global []="GLOBAL" // Global script.
,bbstype []="BTYPE" // BBS type.
,user []="NAME" // User name
,addr []="ADDR" // Address
,mail []="MAIL" // Mail address
,state []="STATE" // State
,htel []="HTEL" // Home phone
,wtel []="WTEL" // Work phone
,passw []="PASSW" // Actual password
,PutLine []="PUTLINE" // Send one line.
,cpu []="CPU" // Computer model
,modem []="MODEM" // Type of modem
;
int tol = 300 // No activity for ½ minute
,stat, tmark // makes script time out.
,Enter = 13 // Code for Enter (CR).
;
//-----------------------------------------------------------
// Script starts here.
//-----------------------------------------------------------
main()
{
int c, i
,na // Trig for user name,
,sa // street address
,pc // postal code
,hp // Home phone
,uo // Use other systems?
,wo // Which ones?
,sl // Interests?
;
entry(); // Updates colors & status bar.
// Only if online.
if (!carrier())
{ alarm(1);
status_wind ("T²: THIS SCRIPT ONLY WORKS IF YOU'RE ONLINE!",20);
return (0);
}
call (global,"R",bbstype,line); // Get BBS type. Should be OPUS.
if (line != thisBBStype)
{ wrongBBS();
return (-1);
}
// Check incoming text.
waitfor ("register? (y,n)",5);
call (PutLine,"Y",Enter);
na = track ("FIRST and LAST):", 0); // User name.
sa = track ("Address:", 0); // ......street address
pc = track ("PostCode", 0); // Postal code & place
hp = track (" Number:", 0); // Phone number
uo = track ("System)?", 0); // Use other systems?
wo = track (" one(s):", 0); // Which ones?
sl = track ("6 Left> ", 0); // Interests?
tmark = timer_start (tol); // wait up to 30 sec. for
// each response.
while ((stat=trig()) > 0) // answer any logon questions
{ if (stat == na) // User name
output (user);
else if (stat == sa) // Street address
output (addr);
else if (stat == pc) // Postal code.
output (mail); // give street address.
else if (stat == hp) // Home telephone number
output (htel); // give home phone number.
else if (stat == uo) // Use other systems?
call (PutLine,"Y",Enter);
else if (stat == wo) // Which ones?
call (PutLine,"Irrelevant",Enter);
else if (stat == sl) // Special interests?
break;
}
release();
na = track ("Left>", 0); // Answer nothing to this.
sl = track ("Last Line>", 0); // Last line.
sa = track ("e running?", 0); // What equipment?
call (PutLine,"BBSing", Enter);
tmark = timer_start (tol); // wait up to 30 sec. for
// each response.
while ((stat=trig()) > 0) // answer any logon questions
{ if (stat==na || stat==sl) // No answer
call (PutLine," ", Enter);
else if (stat == sa) // Equipment?
break;
}
release();
read (cpu,line); // Get computer equipment.
call (PutLine,line, Enter);
read (modem,line); // Get modem.
call (PutLine,line, Enter);
waitfor ("Line",1);
call (PutLine," ", Enter);
waitfor ("this system:",2);
read (passw,line); // Get password.
cputs (line);
cputc (Enter);
waitfor ("e more time:",2); // One more time.
cputs (line);
cputc (Enter);
waitfor ("CITY and STATE:", 2);
read (mail,line); // Get city.
for (i=0; i<strlen (line); ++i)
{ c=subchr (line,i); // Don't send number or space.
if (c >='A') cputc (c);
}
cputc (' ');
output (state); // Send country.
waitfor ("[y,N,?=help]?", 3);
call (PutLine,"n",Enter);
waitfor (" [1,2]",1);
call (PutLine,"1",Enter);
waitfor ("[y,N,?=help]?", 3);
call (PutLine,"Y",Enter);
waitfor ("[y,N,?=help]?", 3);
na = track ("ENTER to continue",1);
sl = track ("Select:", 0);
wo = track ("More [Y,n,=]?", 0); // Stop list.
call (PutLine,"Y",Enter);
tmark = timer_start (tol); // wait up to 30 sec.
cputs ("^M");
while ((stat=trig()) > 0) // answer any logon questions
{ if (stat == na) // No answer
cputs ("^M");
else if (stat == wo) // More?
call (PutLine, "N", Enter); // No.
else if (stat == sl) // Select?
break;
}
release();
return (0);
}
//-----------------------------------------------------------
// Wrong BBS type.
//-----------------------------------------------------------
wrongBBS()
{
str help[48];
failtone(); // Alarm.
help = "This script is for "; // Catenate strings.
strcat (help,thisBBStype);
strcat (help," only!");
status_wind (help,20); // Display message for 2 sec.
}
//-----------------------------------------------------------
// Play fail tone.
//-----------------------------------------------------------
failtone()
{
int n;
for (n=140; n > 10; n = 100*n/120)
{ tone(n*10,12); // Fail tone!!
terminal(); // Process text.
}
}
//-----------------------------------------------------------
// Routine to update colors and status bar.
//-----------------------------------------------------------
entry ()
{
_back_color = 1;
_fore_color = 14;
update_term();
}
//-----------------------------------------------------------
// Free timer and tracks.
//-----------------------------------------------------------
release()
{
timer_free (tmark);
track_free(0);
}
//-----------------------------------------------------------
// Trig loop. Waits here until either one "trig string" is
// found, or we have a time-out, or carrier is lost.
//-----------------------------------------------------------
trig()
{
int i;
do
{ terminal();
} while (!time_up (tmark) // Loop until time-out
&& carrier() // or carrier lost
&& (i=track_hit(0))==0); // or we trigged.
if (i==0)
i = -1; // Error!
else
timer_restart (tmark,tol); // Restore timer.
return (i);
}
//-----------------------------------------------------------
// Send a global variable to the BBS.
//-----------------------------------------------------------
output (str name)
{
int i;
call (global,"R",name,l